package com.ymatou.iapi.dguser.testcase;

import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.dguser.parameter.UserCreateBean;
import com.ymatou.iapi.dguser.service.UserCreateCall;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.business.service.DGUserCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.mapping.godmch.agentLogMapper;
import com.ymttest.database.model.DGThirdPartyBindInfo;
import com.ymttest.database.model.DGUserExtInfo;
import com.ymttest.database.model.DGUserInfo;
import com.ymttest.database.model.DGWxUnionidBindInfo;
import com.ymttest.database.sqlwapper.DGUserWapper;

/**
 * 创建用户 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_UserCreate {
	private static UserCreateBean usercreateBean;
	private static UserCreateCall usercreateCall;
	DGUserWapper DGUserWapper;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("创建用户");
	}

	@Before
	public void caseUp() {
		usercreateBean = new UserCreateBean();
		usercreateCall = new UserCreateCall();
		DGUserWapper = new DGUserWapper();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(usercreateCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	public UserCreateBean initUsercreateBean() {
		
		UserCreateBean usercreateBean = new UserCreateBean();
		usercreateBean.setAppSource(DGUserCallService.DG_SellerApp);
		usercreateBean.setChannelSource(6);
		usercreateBean.setClientIp(TestDataManager.getRandomIp());
		usercreateBean.setCountryCode("China");
		usercreateBean.setPhysicsDeviceId(TestDataManager.getRandomUUID().toString());
		usercreateBean.setLogicDeviceId(TestDataManager.getRandomUUID().toString());
		usercreateBean.setLoginId("LID" + TestDataManager.getRandomNum(5) + System.currentTimeMillis() % 1000);
		usercreateBean.setLoginPwd("testpwd");
		usercreateBean.setLogoUrl("http://static.ymatou.com/content/images/weixin2d-new.png");
		usercreateBean.setNickname("NickautoTest");
		usercreateBean.setOpenId("oid" + TestDataManager.getRandomNum(5) + System.currentTimeMillis() % 1000);
		usercreateBean.setUnionId("uid" + TestDataManager.getRandomNum(5) + System.currentTimeMillis() % 1000);
		usercreateBean.setRemark("remarkAutoTest");
		usercreateBean.setTerminalSource(0);
		usercreateBean.setUserGender(1);
		usercreateBean.setUserType(0);
		usercreateBean.setWxAppName(DGUserCallService.TestWxsqBuyer);
		return usercreateBean;

	}

	private void verifyDB(UserCreateBean usercreateBean2, Integer uid) {
		Logger.comment("验证DGUserInfo");
		DGUserInfo uinfo = DGUserWapper.selectDGUserInfo(uid).get(0);
		Logger.verifyEquals(usercreateBean2.getIscs() == null ? false : usercreateBean2.getIscs(), uinfo.getIsCs(), "验证IsCs");
		Logger.verifyEquals(usercreateBean2.getLoginId(), uinfo.getLoginId(), "验证LoginId");
		Logger.verifyNotNull(uinfo.getLoginPwd(), "验证LoginPwd");
		Logger.verifyEquals(usercreateBean2.getLogoUrl(), uinfo.getLogoUrl(), "验证LogoUrl");
		if (usercreateBean2.getMobile() != null) {
			Logger.verifyEquals(usercreateBean2.getMobile(), uinfo.getMobile(), "验证Mobile");
		}
		if (usercreateBean2.getMobileAreaCode() != null) {
			Logger.verifyEquals(usercreateBean2.getMobileAreaCode(), uinfo.getMobileAreaCode(), "验证MobileAreaCode");
		}
		if (usercreateBean2.getBelongSellerId() != null) {
			Logger.verifyEquals(usercreateBean2.getBelongSellerId(), uinfo.getBelongSellerId(), "验证BelongSellerId");
		}
		if (usercreateBean2.getShopId() != null) {
			Logger.verifyEquals(usercreateBean2.getShopId(), uinfo.getShopId(), "验证getShopId");
		}
		Logger.verifyEquals(usercreateBean2.getIsSetPwd(), uinfo.getIsSetPwd(), "验证IsSetPwd");
		Logger.verifyEquals(usercreateBean2.getNickname(), uinfo.getNickname(), "验证Nickname");
		Logger.verifyEquals(usercreateBean2.getUserGender()==null?0:usercreateBean2.getUserGender(), uinfo.getUserGender(), "验证UserGender");
		Logger.verifyEquals(usercreateBean2.getUserType()==null?0:usercreateBean2.getUserType(), uinfo.getUserType(), "验证UserType");
		Logger.verifyEquals(0, uinfo.getUserStatus(), "验证UserStatus");
		Logger.comment("验证DGUserExtInfo");
		DGUserExtInfo exinfo = DGUserWapper.selectDGUserExtInfo(uid).get(0);
		Logger.verifyEquals(usercreateBean2.getAppSource(), exinfo.getAppSource(), "验证AppSource");
		Logger.verifyEquals(usercreateBean2.getChannelSource()==null?0:usercreateBean2.getChannelSource(), exinfo.getChannelSource(), "验证ChannelSource");
		if (usercreateBean2.getClientIp() != null) {
			Logger.verifyEquals(usercreateBean2.getClientIp(), exinfo.getClientIp(), "验证ClientIp");
		}
		Logger.verifyEquals(usercreateBean2.getCountryCode(), exinfo.getCountryCode(), "验证CountryCode");
		Logger.verifyEquals(usercreateBean2.getPhysicsDeviceId(), exinfo.getPhysicsDeviceId(), "验证DeviceId");
		Logger.verifyEquals(usercreateBean2.getLogicDeviceId(), exinfo.getLogicDeviceId(), "验证EquipmentId");
		if (usercreateBean2.getInvitationCode() != null) {
			Logger.verifyEquals(usercreateBean2.getInvitationCode(), exinfo.getInvitationCode(), "验证InvitationCode");
		}
		if (usercreateBean2.getRemark() != null) {
			Logger.verifyEquals(usercreateBean2.getRemark(), exinfo.getRemark(), "验证Remark");
		}
		Logger.verifyEquals(usercreateBean2.getTerminalSource()==null?0:usercreateBean2.getTerminalSource(), exinfo.getTerminalSource(), "验证TerminalSource");
		Logger.comment("验证DGThirdPartyBindInfo");
		DGThirdPartyBindInfo tpinfo = DGUserWapper.selectDGThirdPartyBindInfo(uid).get(0);
		// 多绑定关系在login站点考虑 这里主要看数据落地正确
		Logger.verifyEquals(usercreateBean2.getAppSource(), tpinfo.getAppSource(), "验证AppSource");
		Logger.verifyEquals(usercreateBean2.getOpenId(), tpinfo.getOpenId(), "验证OpenId");
		Logger.verifyEquals(usercreateBean2.getChannelSource()==null?0:usercreateBean2.getChannelSource(), tpinfo.getThirdPartyType(), "验证ThirdPartyType");
		if (usercreateBean2.getUnionId() != null) {
			Logger.verifyEquals(usercreateBean2.getUnionId(), tpinfo.getUnionId(), "验证UnionId");
		}
		Logger.verifyEquals(usercreateBean2.getUserType()==null?0:usercreateBean2.getUserType(), tpinfo.getUserType(), "验证UserType");

		Logger.comment("验证DGWxUnionidBindInfo");
		List<DGWxUnionidBindInfo> wxuinfo = DGUserWapper.selectDGWxUnionidBindInfo(uid);
		if (wxuinfo.size() > 0) {
			Logger.verifyEquals(usercreateBean2.getUserType()==null?0:usercreateBean2.getUserType(), wxuinfo.get(0).getUserType(), "验证UserType");
			Logger.verifyEquals(usercreateBean2.getUnionId(), wxuinfo.get(0).getUnionId(), "验证UnionId");
			
			
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_UserCreate_001() {
		Logger.start(true, "创建买家用户成功");
		try {
			usercreateBean=initUsercreateBean();
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证uid");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
			
		} catch (Exception e) {
			Logger.fail(e);
		}
		
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_002() {
		Logger.start(true, "创建商家用户成功");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setMobile(TestDataManager.getPhoneNum());
			usercreateBean.setMobileAreaCode("86");
			usercreateBean.setUserType(1);
			usercreateBean.setIsSetPwd(true);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_003() {
		Logger.start(true, "创建独立小程序买家用户成功不传入belongSellerId，创建成功");
		try {
			usercreateBean=initUsercreateBean();
//			usercreateBean.setBelongSellerId(1);
//			usercreateBean.setMobile(TestDataManager.getPhoneNum());
//			usercreateBean.setMobileAreaCode("86");
//			usercreateBean.setUserType(1);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_004() {
		Logger.start(true, "创建商家用户不输入mobile失败");
		try {
			usercreateBean=initUsercreateBean();
//			usercreateBean.setMobile(TestDataManager.getPhoneNum());
			usercreateBean.setMobileAreaCode("86");
			usercreateBean.setUserType(1);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_005() {
		Logger.start(true, "创建买家用户不输入mobile成功");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setMobile(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	public void Tc_UserCreate_0051() {
		Logger.start(true, "创建批量，不乱码");
		try {
			
			for (int i = 0; i < 30; i++) {
				usercreateBean=initUsercreateBean();
				usercreateBean.setMobile(TestDataManager.getPhoneNum());
				usercreateCall.setData(usercreateBean);
				usercreateCall.callService();
				Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
				Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
				verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
				
				
				usercreateBean=initUsercreateBean();
				usercreateBean.setMobile("测试"+TestDataManager.getPhoneNum());
				usercreateCall.setData(usercreateBean);
				usercreateCall.callService();
				Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
				Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
				verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
				
				usercreateBean=initUsercreateBean();
				usercreateBean.setMobile("test"+TestDataManager.getPhoneNum());
				usercreateCall.setData(usercreateBean);
				usercreateCall.callService();
				Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
				Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
				verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
				
				
			}
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_006() {
		Logger.start(true, "创建商家用户不输入mobileAreaCode失败");
		try {     
			usercreateBean=initUsercreateBean();
			usercreateBean.setMobile(TestDataManager.getPhoneNum());
//			usercreateBean.setMobileAreaCode("86");
			usercreateBean.setUserType(1);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_007() {
		Logger.start(true, "创建买家用户不输入mobileAreaCode成功");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setMobileAreaCode(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_008() {
		Logger.start(true, "创建买家用户不输入loginid失败");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setLoginId(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_009() {
		Logger.start(true, "创建买家用户输入loginid重复失败");
		try {
			usercreateBean=initUsercreateBean();
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));
			//相当于重复发送失败
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_010() {
		Logger.start(true, "创建买家用户不输入loginPwd失败");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setLoginPwd(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_011() {
		Logger.start(true, "创建用户不输入userType默认买家");
		try {
			//？自动兼容?
			usercreateBean=initUsercreateBean();
			usercreateBean.setUserType(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_012() {
		Logger.start(true, "创建用户不输入userGender默认0未知");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setUserGender(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_013() {
		Logger.start(true, "创建用户不输入nickname失败");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setNickname(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_014() {
		Logger.start(true, "创建用户不输入logoUrl成功-允许空");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setLogoUrl(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
//			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_015() {
		Logger.start(true, "创建客服用户成功isCs为true");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setIscs(true);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	//用户服务不判断invitationCode 只落地数据
	public void Tc_UserCreate_016() {
		Logger.start(true, "创建代理商成功countryCode国内invitationCode必填");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setMobile(TestDataManager.getPhoneNum());
			usercreateBean.setMobileAreaCode("86");
			usercreateBean.setUserType(1);
			usercreateBean.setInvitationCode("test");
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	public void Tc_UserCreate_017() {
		Logger.start(true, "创建代理商countryCode国内invitationCode不输入失败");
		try {
			// TODO 补全case代码
			org.junit.Assert.fail();
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_018() {
		Logger.start(true, "创建用户不输入channelSource默认0");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setChannelSource(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_019() {
		Logger.start(true, "创建用户不输入terminalSource默认0");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setTerminalSource(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_020() {
		Logger.start(true, "创建用户不输入appSource失败");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setAppSource(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	//20190731-开放接口去除校验-by 戈建华
	public void Tc_UserCreate_021() {
		Logger.start(true, "创建用户不输入PhysicsDeviceId失败");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setPhysicsDeviceId(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	//20190731-开放接口去除校验-by 戈建华
	public void Tc_UserCreate_022() {
		Logger.start(true, "创建用户不输入LogicDeviceId失败");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setLogicDeviceId(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_023() {
		Logger.start(true, "创建用户不输入unionId也能成功");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setUnionId(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	//20190731-开放接口去除校验-by 戈建华
	public void Tc_UserCreate_024() {
		Logger.start(true, "创建用户不输入openId失败");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setOpenId(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");
			Logger.comment(usercreateCall.getString("errorMessage"));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_UserCreate_025() {
		Logger.start(true, "创建买家用户成功输入参数BelongSellerId-独立小程序用");
		try {
			usercreateBean=initUsercreateBean();
//			usercreateBean.setBelongSellerId(1000);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证uid");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_UserCreate_026() {
		Logger.start(true, "ipv6创建买家用户成功-bug");
		try {
			usercreateBean=initUsercreateBean();
			usercreateBean.setClientIp(TestDataManager.getRandomIpV6());
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证uid");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	public void Tc_UserCreate_027() {//此接口是通用接口，不做密码校验
		Logger.start(true, "创建用户,简单密码");
		try {
			usercreateBean = initUsercreateBean();
			usercreateBean.setLoginPwd("1231");
			usercreateBean.setIsSetPwd(true);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_028() {//此接口是通用接口，不做密码校验
		Logger.start(true, "创建的时候 logind不同，openid和wxappname相同");
		try {
			usercreateBean = initUsercreateBean();
			UserCreateBean usercreateBean1 = initUsercreateBean();
			usercreateBean1.setOpenId(usercreateBean.getOpenId());
			usercreateBean1.setWxAppName(usercreateBean.getWxAppName());
			usercreateBean.setLoginPwd("1231");
			usercreateBean.setIsSetPwd(true);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
			usercreateCall.setData(usercreateBean1);
			usercreateCall.callService();
			
			
			Logger.verifyEquals("false", usercreateCall.getString("success"), "验证success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_029() {//此接口是通用接口，不做密码校验
		Logger.start(true, "不传入belongSellerId，会根据wxappname找");
		try {
			usercreateBean = initUsercreateBean();
			usercreateBean.setLoginPwd("1231");
			usercreateBean.setIsSetPwd(true);
			usercreateBean.setWxAppName("500326937");
			usercreateBean.setBelongSellerId(null);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			usercreateBean.setBelongSellerId(500326937);
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_UserCreate_030() {//此接口是通用接口，不做密码校验
		Logger.start(true, "传入belongSellerId,直接入库");
		try {
			usercreateBean = initUsercreateBean();
			usercreateBean.setLoginPwd("1231");
			usercreateBean.setIsSetPwd(true);
			usercreateBean.setBelongSellerId(1122334455);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证suuserIdccess");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_UserCreate_031() {
		Logger.start(true, "创建分销员用户成功");
		try {
			usercreateBean=initUsercreateBean();
			Integer shopId=GodmchManageCallService.CreateSellerMch();
			usercreateBean.setShopId(shopId);
			usercreateBean.setUserType(3);
			usercreateCall.setData(usercreateBean);
			usercreateCall.callService();
			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证uid");
			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
			
		} catch (Exception e) {
			Logger.fail(e);
		}
		
	}
//	@Test
//	@Category({ P1.class })
//	@TestCase
//	public void Tc_UserCreate_032() {
//		Logger.start(true, "创建买家用户成功-nick为空");
//		try {
//			usercreateBean=initUsercreateBean();
//			usercreateBean.setNickname("");
//			usercreateCall.setData(usercreateBean);
//			usercreateCall.callService();
//			Logger.verifyEquals("true", usercreateCall.getString("success"), "验证success");
//			Logger.verifyNotNull(usercreateCall.getString("userId"), "验证uid");
//			verifyDB(usercreateBean, Integer.valueOf(usercreateCall.getString("userId")));
//			
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//		
//	}
}